<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>

<!-- 

Generic file to include for array management.
Known embedded java variables :
- curPage : a ArrayPage object.
- arrayForm : the name of formular

-->

<script>
function selectElement(id,type) {
	document.forms["<%=arrayFormName%>"].method.value='selectElement';
	document.forms["<%=arrayFormName%>"].idElement.value=id;
	document.forms["<%=arrayFormName%>"].submit();
}
</script>

<html:hidden property="idElement" value="null"/>
<html:hidden property="elementType" value="null"/>

<%
	int lines = curPage.getLines();
	if(lines==0) {
%>
	<%=curPage.getNoElementMessage()%>
<%
	} else {
%>
<table class="array">
	<tr>
<%
		int columns = curPage.countCols();
		for ( int i = 0 ; i < columns ; i++ ) {
%>
			<th><%=curPage.getTitle(i)%></th>
<%
  }
%>
	</tr>	
<%
		for ( int i = 0 ; i < lines ; i++ ) {
%>
	<tr>
<%
			for ( int j = 0 ; j < columns ; j++ ) {
%>
		<td><%=curPage.getCell(i,j)%></td>
<%
			}
%>
	</tr>
<%
		}
	}
%>
<table>